<?php


namespace Mslynn\Productsale\Block;


use Magento\Catalog\Model\Product;
use Magento\Framework\View\Element\Template;

class SaleBlock extends  Template
{
    /**
     * @var Product
     */
    protected $_product = null;

    /**
     * Core registry
     *
     * @var \Magento\Framework\Registry
     */
    protected $_coreRegistry = null;
    /**
     * @param \Magento\Framework\View\Element\Template\Context $context
     * @param \Magento\Framework\Registry $registry
     * @param array $data
     */
    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context,
        \Magento\Framework\Registry $registry,
        array $data = []
    ) {
        $this->_coreRegistry = $registry;
        parent::__construct($context, $data);
    }


    /**
     * @return Product
     */
    public function getSold()
    {
        if (!$this->_product) {
            $this->_product = $this->_coreRegistry->registry('product');
        }

       return  $this->_product->getData('sale_number');

    }

}